/*
* Licensed under the MIT License
* 
* Copyright (c) 2010 Kay Kreuning
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* 
* http://code.google.com/p/as3hyvesapi
*/
package nl.hyvesstudio.oauth
{
	import flash.events.IEventDispatcher;
	import flash.net.URLRequest;
	
	import nl.hyvesstudio.oauth.authorization.IAuthorizer;
	import nl.hyvesstudio.oauth.signing.ISignatureMethod;
	
	/**
	 * Interface for OAuth services.
	 * 
	 * @author Kay Kreuning
	 */
	public interface IOAuthService extends IEventDispatcher
	{
		/** <code>Accesstoken</code> used for authorization */
		function get accesstoken():Accesstoken;
		
		/** @private */
		function set accesstoken(value:Accesstoken):void;
		
		/** <code>ISignatureMethod</code> sued to generated OAuth signatures */
		function get signatureMethod():ISignatureMethod;
		
		/** @private */
		function set signatureMethod(value:ISignatureMethod):void;
		
		/** HTTP method used to encode requests */
		function get httpMethod():String;
		
		/** @private */
		function set httpMethod(value:String):void;
		
		/** <code>true</code> if we are authorized, otherwise <code>false</code> */
		function get isAuthorized():Boolean;
		
		/**
		 * Create a valid OAuth compatible <code>URLRequest</code> for the parameters specified.
		 * 
		 * @param url URL to make the request for
		 * @param parameters Object holding all the parameters for the request
		 * @return <code>URLRequest</code> for the specified parameters
		 */
		function createURLRequest(url:String, parameters:Object):URLRequest;
		
		/**
		 * Autorize this service with the specified <code>IAuthorizer</code>.
		 * 
		 * @param authorizer <code>IAuthorizer</code> that handles the authorization process
		 */
		function authorize(authorizer:IAuthorizer):void;
	}
}